package org.test04;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

public class MainTest {
    public static void main(String[] args) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException {
        List<String> list = new ArrayList<>();
        Class<?> clazz = list.getClass();
        Method addMethod = clazz.getDeclaredMethod("add" , Object.class);
        addMethod.invoke(list, "AAA");
        addMethod.invoke(list, 100);
        System.out.println(list);
    }
}
